import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/game_list_entity.dart';

GameListEntity $GameListEntityFromJson(Map<String, dynamic> json) {
  final GameListEntity gameListEntity = GameListEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    gameListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    gameListEntity.msg = msg;
  }
  final List<GameListData>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<GameListData>(e) as GameListData).toList();
  if (data != null) {
    gameListEntity.data = data;
  }
  return gameListEntity;
}

Map<String, dynamic> $GameListEntityToJson(GameListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension GameListEntityExtension on GameListEntity {
  GameListEntity copyWith({
    int? code,
    String? msg,
    List<GameListData>? data,
  }) {
    return GameListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

GameListData $GameListDataFromJson(Map<String, dynamic> json) {
  final GameListData gameListData = GameListData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    gameListData.id = id;
  }
  final String? backimg = jsonConvert.convert<String>(json['backimg']);
  if (backimg != null) {
    gameListData.backimg = backimg;
  }
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    gameListData.type = type;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    gameListData.name = name;
  }
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    gameListData.code = code;
  }
  return gameListData;
}

Map<String, dynamic> $GameListDataToJson(GameListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['backimg'] = entity.backimg;
  data['type'] = entity.type;
  data['name'] = entity.name;
  data['code'] = entity.code;
  return data;
}

extension GameListDataExtension on GameListData {
  GameListData copyWith({
    String? id,
    String? backimg,
    String? type,
    String? name,
    String? code,
  }) {
    return GameListData()
      ..id = id ?? this.id
      ..backimg = backimg ?? this.backimg
      ..type = type ?? this.type
      ..name = name ?? this.name
      ..code = code ?? this.code;
  }
}